//
//  WaitAlertView.m
//  FindJob
//
//  Created by 233 on 16/3/2.
//  Copyright © 2016年 Lee. All rights reserved.
//

#import "WaitAlertView.h"

@interface WaitAlertView ()
@property (weak, nonatomic) IBOutlet UIImageView *activityImageView;

@end
@implementation WaitAlertView

- (instancetype)init
{
    self = [super init];
    if (self) {
        // 从Xib（nib） 文件加载视图界面
       self = [[NSBundle mainBundle] loadNibNamed:@"WaitAlertView" owner:self options:nil][0];
        NSMutableArray *images = [NSMutableArray array];
        for (int i = 1; i < 9; i++) {
            NSString *imageName = [NSString stringWithFormat:@"activity_0%d",i];
            UIImage *image = [UIImage imageNamed:imageName];
            [images addObject:image];
        }
        self.frame = [UIScreen mainScreen].bounds;
        self.activityImageView.animationImages = images;
        self.activityImageView.animationDuration = 1.0f;
    }
    return self;
}
- (void)show{
    [[UIApplication sharedApplication].keyWindow addSubview:self];
    [self.activityImageView startAnimating];
}
- (void)hide{
    [self.activityImageView stopAnimating];
    [self removeFromSuperview];
}
@end
